// $(function () {
//     judgeUsernameLogin();
// });


// function judgeUsernameLogin() {
//     let data = myAjax('/common', 'get', {});
//     console.log(data);
//     if (data.result == -1) {
//         window.location.href = "/login.html";
//     }
//
// }

function myAjax(url, type, data) {
    // judgeUsernameLogin();
    let URL = "http://localhost:8080";
    let result = null;
    $.ajax({
        url: URL + url,
        type: type,
        data: data,
        async: false,
        dataType: 'json',
        xhrFields: {
            withCredentials: true //允许跨域带Cookie
        },
        success: function (data) {
            result = data;

        }
    });
    return result;
}

function imgMyAjax(url,type,data) {
    let URL = "http://localhost:8080";
    let result = null;
    $.ajax({
        url: URL + url,
        type: type,
        data: data,
        async: false,
        dataType: 'json',
        processData: false,
        contentType: false,
        xhrFields: {
            withCredentials: true //允许跨域带Cookie
        },
        success: function (data) {//data后台传递到前台的数据
            result = data;
            // console.log(result);
        }
    });
    return result;

}